package hanjia;

import suanfa.ListNode;

/**
 * Description:
 * Author:    Dane
 * CreateTime:2025/2/10-下午2:40
 * Since  :   1.0
 * Version:   1.0
 */
public class LeetCode206 {

    public ListNode reverseList(ListNode head) {
        if (head==null||head.next==null){
            return head;
        }

        ListNode temp=head;
        ListNode pre=null;
        while (temp!=null){
            ListNode next=temp.next;
            temp.next=pre;
            pre=temp;
            temp=next;

        }
        return pre;


    }
}
